<?php
/**
 * Geneone: Content Management Framework
 * File Namespace
 *
 * http://geneone.neondragon.net/
 *
 * @package Geneone
 * @author Khlo
 * @version 1.0
 * @copyright 2004-2006 Geneone Development Team
 */
 
class Gene_Namespace_File {
	/**
	 * Calls page in this namespace.
	 *
	 * @static
	 * @var $id string Page ID in Namespace
	 * @var $action array Action Argument String
	 * @return bool Status
	 */
	function call($id, $action=array()) {
		$db =& Gene::getDatabase();
		
		require_once ("Gene/File/Common.php");
		$file =& Gene_File_Common::get((int)$id);
		
		if ($file) {
			if ($file->canView()) {
				header ("Content-Type: ".$file->fileInfo['mime_type']);
				
				echo $file->getContent();
				
				exit();
			} else {
				return false;
			}
		} else {
			return false;
		}
	}
	
	/**
	 * Exports document as XML.
	 *
	 * @var $id string Page ID
	 *
	 * @return boolean Status
	 */
	function exportXml($id) {
		return false;
	}
	
	/**
	 * Runs web services.
	 *
	 * @var $method string Method to Call
	 * @return array/bool Result
	 */
	function runWebServices($method) {
		return false;
	}
	
	/**
	 * Returns whether search is supported by this namespace
	 *
	 * @return bool Searchable Status
	 */
	function isSearchable() {
		return false;
	}
	
	/**
	 * Perform a search in this namespace
	 *
	 * @var $query string Search Term
	 * @var $start integer Result Offset
	 * @var $limit integer Number of Results
	 * @return array Results
	 */
	function search($query, $start=0, $limit=30) {
		return array();
	}
	
	/* This namespace does not implement intelliAnswer */
	function intelliAnswer($phrase) { return false; }
}
?>